package com.small.base.redis.config;

import com.small.base.redis.core.RedisService;
import com.small.base.redis.core.StringRedisService;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;

import javax.annotation.Resource;


/**
 * RedisConfiguration
 *
 * @author miajio
 */
@Configuration
public class RedisConfiguration extends CachingConfigurerSupport {
    @Resource
    private RedisTemplate<String, Object> redisTemplate;
    @Resource
    private StringRedisTemplate stringRedisTemplate;

    @Bean
    public RedisService redisService() {
        return new RedisService(redisTemplate);
    }

    @Bean
    public StringRedisService stringRedisService() {
        return new StringRedisService(stringRedisTemplate);
    }

}
